package com.neusoft.dibuy.ipsumspringbootstarter.service;

import com.neusoft.dibuy.ipsumspringbootstarter.properties.SmsProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

/**
 *
 */

public class SmsTemplate {




    @Autowired
    private SmsProperties smsProperties;

    @Autowired
    private ApplicationContext context;

    public String send(String fromPhone,String toPhone,String content){
        //获取云厂商的业务实现类
        String type = smsProperties.getType();
        SmsService smsService = (SmsService)context.getBean(type);
        return smsService.send(fromPhone,toPhone,content);
    }
}